// 201102112242

#include <iostream>
using namespace std;

class sNode;

bool InsertNode(sNode **inputHead, int data);
bool DeleteNode(sNode **inputHead);
bool DisplayList (sNode *inputHead);

int main(int argc, char* argv[])
{
	sNode *numberList;
	numberList = 0;

	InsertNode(&numberList, 9);
	DisplayList(numberList);

	InsertNode(&numberList, 81);
	DisplayList(numberList);

	InsertNode(&numberList, 84);
	DisplayList(numberList);

	DeleteNode(&numberList);
	DisplayList(numberList);

	DeleteNode(&numberList);
	DisplayList(numberList);

	DeleteNode(&numberList);
	DisplayList(numberList);

	return 0;
}

class sNode
{
public:
	int data;
	sNode* next;
};

bool InsertNode(sNode** inputHead, int data)
{
	sNode* currentNode = new sNode;
	currentNode->data = data;
	currentNode->next = *inputHead;
	*inputHead = currentNode;

	return 0;
}

bool DeleteNode(sNode** inputHead)
{
	sNode* tempCurrentNode = *inputHead;
	*inputHead = tempCurrentNode->next;
	delete tempCurrentNode;

	return 0;
}

bool DisplayList(sNode* inputHead)
{
	cout << "\n";
	if (inputHead == 0)
	{
		cout << "NULL";
	}

	sNode* currentNode;
	currentNode = inputHead;
	
	while (currentNode != 0 )
	{
		cout << currentNode -> data << "\n";
		currentNode = currentNode->next;
	}
	return 0;
}


